package com.shigen.springcloud.controller;

import com.shigen.springcloud.entity.CommonResult;
import com.shigen.springcloud.entity.Payment;
import com.shigen.springcloud.service.PaymentFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "consumer")
public class PaymentFeignController {

  @Autowired
  private PaymentFeignService paymentFeignService;

  @PostMapping(value = "payment/create")
  public CommonResult create(@RequestBody Payment payment) {
    return paymentFeignService.create(payment);
  }

  @GetMapping(value = "payment/getPayment/{id}")
  public CommonResult getPaymentById(@PathVariable("id") Long id) {
    return paymentFeignService.getPaymentById(id);
  }
}
